import myAxios from "@/request";
import type {
  DormitoryQueryRequest,
  DormitoryAddRequest,
  DormitoryUpdateRequest,
} from "@/models/dormitory";

/**
 * 分页获取宿舍列表
 */
export function listDormitoryByPage(
  dormitoryQueryRequest: DormitoryQueryRequest
) {
  return myAxios.request({
    url: "/api/dormitory/list/page",
    method: "post",
    data: dormitoryQueryRequest,
  });
}

/**
 * 添加宿舍
 */
export function addDormitory(param: any) {
  return myAxios.request({
    url: "/api/dormitory/add",
    method: "post",
    data: param,
  });
}

/**
 * 更新宿舍
 */
export function updateDormitory(
  dormitoryUpdateRequest: DormitoryUpdateRequest
) {
  return myAxios.request({
    url: "/api/dormitory/update",
    method: "post",
    data: dormitoryUpdateRequest,
  });
}

/**
 * 删除宿舍
 */
export function deleteDormitory(id: number) {
  return myAxios.request({
    url: "/api/dormitory/delete",
    method: "post",
    data: { id },
  });
}
